package com.zyx.zx.service;

import com.zyx.zx.model.domain.Team;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zyx.zx.model.domain.User;
import com.zyx.zx.model.dto.TeamQuery;
import com.zyx.zx.model.dto.request.TeamJoinRequest;
import com.zyx.zx.model.dto.request.TeamQuitRequest;
import com.zyx.zx.model.dto.request.TeamUpdateRequest;
import com.zyx.zx.model.vo.TeamUserVo;

import java.util.List;

/**
* @author Zhu
* @description 针对表【team(队伍)】的数据库操作Service
* @createDate 2023-04-03 15:41:34
*/
public interface TeamService extends IService<Team> {
    /**
     * 创建队伍
     * @param team
     * @param loginUser
     * @return
     */
    long addTeam(Team team, User loginUser);

    /**
     * 更新队伍
     * @param teamUpdateRequest
     * @param loginUser
     * @return
     */
    boolean updateTeam(TeamUpdateRequest teamUpdateRequest, User loginUser);

    /**
     * 通过 id 查找队伍
     * @param id
     * @param b
     * @param loginUser
     * @return
     */
    TeamUserVo getTeamById(long id, boolean b, User loginUser);

    /**
     * 搜索队伍
     * @param teamQuery
     * @param isAdmin
     * @return
     */
    List<TeamUserVo> listTeams(TeamQuery teamQuery, boolean isAdmin);

    /**
     * 删除队伍
     * @param id
     * @param loginUser
     * @return
     */
    boolean deleteTeam(long id, User loginUser);

    /**
     * 用户加入队伍
     * @param teamJoinRequest
     * @param loginUser
     * @return
     */
    Boolean joinTeam(TeamJoinRequest teamJoinRequest, User loginUser);

    /**
     * 用户退出队伍
     * @param teamQuitRequest
     * @param loginUser
     * @return
     */
    Boolean quitTeam(TeamQuitRequest teamQuitRequest, User loginUser);

    /**
     * 根据用户ID获取队伍
     * @param userId
     * @return
     */
    List<Team> getTeamByUserId(Long userId);
}
